// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
require('./style/rem.less'); //引入全局的base文件

import Vue from 'vue'
import App from './App'
import router from './router'
import MintUI from 'mint-ui'
import 'mint-ui/lib/style.css'
import Vuex from 'vuex'
import store from './vuex/store'

Vue.use(Vuex);
Vue.use(MintUI);
//控制axios简单请求
// axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'
// axios.defaults.transformRequest = [obj => Qs.stringify(obj)]
import axios from 'axios'
import Qs from 'qs'

Vue.prototype.axios = axios;
Vue.prototype.qs = Qs;

import VueWechatTitle from 'vue-wechat-title';
Vue.use(VueWechatTitle)
import AwesomePicker from 'vue-awesome-picker';
Vue.use(AwesomePicker);

Vue.config.productionTip = false
import {
    Field,
    Button,
    DatetimePicker
} from 'mint-ui';


// const HOST = '/agent/' //此处是重点
//
// axios.defaults.baseURL = HOST  //此处是重点
import common from './js/common.js';
import global from './js/global.js'
Vue.use(global);
Vue.prototype.common = common

Vue.filter('dataFormat', function (value, fmt) {
    let getDate = new Date(value);
    let o = {
        'M+': getDate.getMonth() + 1,
        'd+': getDate.getDate(),
        'h+': getDate.getHours(),
        'm+': getDate.getMinutes(),
        's+': getDate.getSeconds(),
        'q+': Math.floor((getDate.getMonth() + 3) / 3),
        'S': getDate.getMilliseconds()
    };
    if (/(y+)/.test(fmt)) {
        fmt = fmt.replace(RegExp.$1, (getDate.getFullYear() + '').substr(4 - RegExp.$1.length))
    }
    for (let k in o) {
        if (new RegExp('(' + k + ')').test(fmt)) {
            fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
        }
    }
    return fmt;
});

Vue.component(DatetimePicker.name, DatetimePicker);

Vue.component(Button.name, Button);
Vue.component(Field.name, Field);
/* eslint-disable no-new */
new Vue({
    el: '#app',
    router,
    store,
    props: ['message'],
    components: {
        App
    },
    template: '<App/>'
})
